package com.yuwei.yurpc.utils;

import cn.hutool.setting.dialect.Props;
import io.netty.util.internal.StringUtil;

/**
 * 用户服务
 *
 * @author yuwei
 * @date 10:55 2024/10/4
 */
public class configUtils {
    public static <T> T loading(Class<T> tClass, String prefix,String env) {
        StringBuilder configBuilder = new StringBuilder("application");
        if(StringUtil.isNullOrEmpty(env)){
            configBuilder.append(".yml");
        }else {
            configBuilder.append("-").append(env).append(".yml");
        }
        Props props = new Props(configBuilder.toString());
        return props.toBean(tClass, prefix);
    }
}
